<template>
  <div class="app-container">
    <el-form :inline="true" ref="ruleForm" :model="formInline" class="demo-form-inline">
      <el-form-item label="解锁时间" prop="time">
        <el-date-picker
          v-model="formInline.time"
          type="daterange"
          align="right"
          unlink-panels
          range-separator="至"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
          value-format="timestamp"
          :picker-options="pickerWeekStep">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="账户名" prop="account">
        <el-input v-model="formInline.account" placeholder="请输入关键词" @keyup.enter.native="$emit('on-filter',formInline)"></el-input>
      </el-form-item>
      <el-form-item label="账户类型" prop="type">
        <el-select v-model="formInline.type" placeholder="请选择账户类型">
          <el-option
            v-for="item in consts.ACCOUNT_TYPE"
            :label="item.title"
            :key="item.value"
            :value="item.value"
          ></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="操作人" prop="lockBy">
        <el-select v-model="formInline.lockBy" placeholder="请选择操作人">
          <el-option label="全部" value=""></el-option>
          <el-option
            v-for="item in operatorList.list"
            :label="item.name"
            :key="item.id"
            :value="item.id"
          ></el-option>
        </el-select>
      </el-form-item>
      <el-button class="filter-item"
                 type="primary"
                 :loading="loading"
                 icon="el-icon-search"
                 @click="$emit('on-filter',formInline)">搜索
      </el-button>
      <el-button @click="selfResetForm('ruleForm')">重置</el-button>
    </el-form>
  </div>

</template>

<script>
  import {getAuditOperator} from "@/services/api/audit";
  import {form,grid,pickerOption} from '@/build'

  export default {
    name: "unlock-filter",
    mixins: [form,grid,pickerOption],
    data() {
      return {
        operatorList: [],
        formInline: {
          time: '',
          type:'',
          lockLimit:'',
          lockBy:'',
          account:'',
          lockType:''
        },
      }
    },
    methods: {
      selfResetForm(formName){
        this.resetForm(formName)
        this.$parent.getAll()
      }
    },
    mounted(){
      this.bindGet(getAuditOperator, 'operatorList', {
      });
      this.getAll()
    }
  }
</script>

<style lang="scss" scoped>
  .with-pre-select {
    .el-input-group__prepend {
      .el-select {
        width: 160px;
      }
    }
  }

  .money-range {
    .el-input {
      width: 100px;
    }
  }

</style>
